using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MSRI.HelperClasses;
using Instedd.Labs.Geo.Library.Kml;
using Mvp.Xml.Common.Xsl;
using System.Xml;
using System.IO;
using System.Xml.Xsl;
using System.Collections.Specialized;
using Instedd.Labs.Geo.Library.Sms;

namespace Instedd.Labs.Geo.Library.Tests.Managers
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class ConfigurationFixture
    {
        public ConfigurationFixture()
        {
        }

        [TestMethod]
        public void AbsolutePathsAndFileNamesSetsConfigurationPropertiesWithoutChangingItsValues()
        {
            Configuration configuration = new Configuration();

            NameValueCollection values = new NameValueCollection();
            values.Add("SenderNameLookupPath", @"c:\value1.csv");
            values.Add("KmlOutput", @"c:\value2");
            values.Add("RssOutput", @"c:\value3");

            configuration.Load(values);

            Assert.AreEqual(@"c:\value1.csv", configuration.SenderNameLookupPath);
            Assert.AreEqual(@"c:\value2", configuration.KmlOutput);
            Assert.AreEqual(@"c:\value3", configuration.RssOutput);
        }

        [TestMethod]
        public void RelativePathsAndFileNamesSetsConfigurationPropertiesUsingPathResolver()
        {
            Configuration configuration = new Configuration();

            NameValueCollection values = new NameValueCollection();
            values.Add("SenderNameLookupPath", @"value1.csv");
            values.Add("KmlOutput", @"value2");
            values.Add("RssOutput", @"value3");

            configuration.Load(values);

            Assert.AreEqual(PathResolver.TryToResolveUsingDataDirectory(@"value1.csv"), configuration.SenderNameLookupPath);
            Assert.AreEqual(PathResolver.TryToResolveUsingBaseDirectory(@"value2"), configuration.KmlOutput);
            Assert.AreEqual(PathResolver.TryToResolveUsingBaseDirectory(@"value3"), configuration.RssOutput);
        }

        [TestMethod]
        public void DefaultLocationSetsConfigurationProperty()
        {
            Configuration configuration = new Configuration();

            NameValueCollection values = new NameValueCollection();
            values.Add("DefaultLocation", @"22.33*55.88");

            configuration.Load(values);

            Assert.AreEqual(@"22.33*55.88", configuration.DefaultLocation);
        }
    }
}